<template>
	<view class="wrap center">
		<view v-for="item in state.list" :key="item.formId" class="item" @click="to(item)">
			<u-text type="primary" align="center" :text="item.formName"></u-text>
			<u-text type="info"  align="center" :size="13" :text="item.formCode"></u-text>
		</view>
	</view>
</template>

<script lang="ts" setup>
import { onLoad } from "@dcloudio/uni-app"
import { reactive } from 'vue'
import { request } from '../../utils/request'

const state = reactive({ list: [] as any[]})

const getData = () => {
	request.get('/flw/form-def?pageNum=1&pageSize=16', { params: { state: 1 } }).then((resp: any) => {
		if (resp.success) {
			state.list = resp.data.list
		}
	})
}

onLoad(() => {
	getData()
})

const to = (item: any) => {
	uni.navigateTo({
		url: `/pages/apply/form?id=${item.formId}`,
	});
}

</script>

<style lang="scss" scoped>
.item {
	text-align: center;
	padding: 20rpx;
	border-radius: 12rpx;
	box-shadow: 0 20rpx 20rpx rgba(0, 0, 0, 0.05);
	background: white;
	margin: 20rpx;
}
</style>
